package com.sky.mapper;


import com.sky.annotation.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {


    /**
     * 根据菜品id查对应套餐id
     * @param dishIds
     * @return
     */
   List<Long> getSetmealIdByDish(List<Long> dishIds);


    /**
     * 批量保存套餐和菜品的关联关系
     * @param setmealDishes
     */
    @AutoFill(value = OperationType.INSERT)
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * 跟据套餐id删
     * @param setmelId
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{setmelId}")
    void deleteBySetmelId(Long setmelId);

    /**
     * 跟据SetmelId查dish
     * @param SetmelId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{SetmelId}")
    List<SetmealDish> getBySetmelId(Long SetmelId);


}
